/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.util.Date;
import org.json.JSONObject;
import utilities.Key;

/**
 *
 * @author olawale
 */
public class User {

    public User(String resultString) throws Exception{
        JSONObject result = new JSONObject(resultString);

        id = result.optLong(Key.id, -1);
        name = result.optString(Key.name);
        screenName = result.optString(Key.screen_name);
        location = result.optString(Key.location);
        description = result.optString(Key.description);
        profileImageUrl = result.optString(Key.profile_background_image_url);
        url = result.optString(Key.url);
        protected_ = result.optBoolean(Key.protected_);
        followersCount = result.optInt(Key.followers_count);
        profileBackgroundColor = result.optString(Key.profile_background_color);
        profileTextColor = result.optString(Key.profile_text_color);
        profileLinkColor = result.optString(Key.profile_link_color);
        profileSidebarFillColor = result.optString(Key.profile_sidebar_fill_color);
        friendsCount = result.optInt(Key.friends_count, -1);
        createdAt = null;
        favouritesCount = result.optInt(Key.favourites_count, -1);
        utcOffset = result.optInt(Key.utc_offset, -1);
        timeZone = result.optString(Key.time_zone);
        profileBackgroundImageUrl = result.optString(Key.profile_background_image_url);
        profileBackgroundTile = result.optBoolean(Key.profile_background_tile);
        statusesCount = result.optInt(Key.statuses_count, -1);
        notifications = result.optBoolean(Key.notifications);
        following = result.optBoolean(Key.following);
        verified = result.optBoolean(Key.verified);
        geoEnabled = result.optBoolean(Key.geo_enabled);
    }

    public final long id;
    public final String name;
    public final String screenName;
    public final String location;
    public final String description;
    public final String profileImageUrl;
    public final String url;
    public final boolean protected_;
    public final int followersCount;
    public final String profileBackgroundColor;
    public final String profileTextColor;
    public final String profileLinkColor;
    public final String profileSidebarFillColor;
    public final int friendsCount;
    public final Date createdAt;
    public final int favouritesCount;
    public final int utcOffset;
    public final String timeZone;
    public final String profileBackgroundImageUrl;
    public final boolean profileBackgroundTile;
    public final int statusesCount;
    public final boolean notifications;
    public final boolean following;
    public final boolean verified;
    public final boolean geoEnabled;

}
